import request from '@/utils/request'
import { commonBaseUrl } from '@/utils'

const moduleName = commonBaseUrl('D') || 'material/'

// 查询物资绑定列表
export function queryProductInfoList(params) {
    return request({
        url: moduleName + 'api/bind/product/queryProductInfoList',
        method: 'post',
        data: params,
        showLoading: true
    })
}

// 查询对应签码集合
export function queryOsDetailIdAndAssetLabelList(params) {
    return request({
        url: moduleName + 'api/bind/product/queryOsDetailIdAndAssetLabelList',
        method: 'post',
        data: params,
        showLoading: true
    })
}

// 根据子项目流水号查询所有子项目信息用作表头展示
export function queryHeaderIniInfoList(params) {
    return request({
        url: moduleName + 'api/bind/product/queryHeaderIniInfoList',
        method: 'post',
        data: params,
        showLoading: false
    })
}

// 校验绑定数据 弱校验
export function optionalConfirmProductBindingBefore(params) {
    return request({
        url: moduleName + 'api/bind/product/optionalConfirmProductBindingBefore',
        method: 'post',
        data: params,
        showLoading: true,
        hideMessage: true
    })
}

// 校验绑定数据 强校验
export function confirmProductBindingBefore(params) {
    return request({
        url: moduleName + '/api/bind/product/confirmProductBindingBefore',
        method: 'post',
        data: params,
        showLoading: true,
        hideMessage: true
    })
}

// 物资绑定取消确认
export function batchUpdateAccState(params) {
    return request({
        url: moduleName + '/api/bind/product/batchUpdateAccState',
        method: 'post',
        data: params,
        showLoading: true,
        hideMessage: true
    })
}

// 按设计方案进行绑定物资
export function updateProductBindingDataByDesign(params) {
    return request({
        url: moduleName + 'api/bind/product/updateProductBindingDataByDesign',
        method: 'post',
        data: params,
        showLoading: true,
        hideMessage: true
    })
}

// 保存绑定物资
export function saveProductBindingData(params) {
    return request({
        url: moduleName + 'api/bind/product/saveProductBindingData',
        method: 'post',
        data: params,
        showLoading: true
    })
}
// 查询服务绑定列表
export function queryServBoundingList(params) {
    return request({
        url: moduleName + 'api/insVa/module/queryServBoundingList',
        method: 'post',
        data: params,
        showLoading: true
    })
}

// 查询整体项目下管理区域列表
export function queryParentPrjAreaList(params) {
    return request({
        url: moduleName + 'inspection/queryParentPrjAreaList',
        method: 'post',
        data: params,
        showLoading: true
    })
}

// 更新服务绑定接口
export function updateServBoundingData(params) {
    return request({
        url: moduleName + 'api/insVa/module/updateServBoundingData',
        method: 'post',
        data: params,
        showLoading: true
    })
}

// 按设计方案进行绑定服务
export function updateServBoundingDataByDesign(params) {
    return request({
        url: moduleName + 'api/insVa/module/updateServBoundingDataByDesign',
        method: 'post',
        data: params,
        showLoading: true,
        hideMessage: true
    })
}

// 确认服务页面确认绑定结果
export function confirmPushServiceBindingToSH(params) {
    return request({
        url: moduleName + 'api/insVa/module/confirmPushServiceBindingToSH',
        method: 'post',
        data: params,
        showLoading: true,
        hideMessage: true
    })
}

// 服务绑定界面单元格编辑校验
export function checkServiceBoundingEdit(params) {
    return request({
        url: moduleName + 'api/insVa/module/checkServiceBoundingEdit?serviceCode=' + params.serviceCode + '&num=' + params.num + '&parentPrjId=' + params.parentPrjId,
        method: 'get',
        showLoading: false,
        hideMessage: true
    })
}

// 监理单位确认服务绑定校验
export function checkServiceBoundingConfirm(params) {
    return request({
        url: moduleName + 'api/insVa/module/checkServiceBoundingConfirm',
        method: 'post',
        data: params,
        showLoading: true,
        hideMessage: true
    })
}

// 项目管理岗确认服务绑定校验
export function checkPmServiceBoundingConfirm(params) {
    return request({
        url: moduleName + '/api/insVa/module/checkPmServiceBoundingConfirm',
        method: 'post',
        data: params,
        showLoading: true,
        hideMessage: true
    })
}
// 查询签码列表集合
export function filterAssetLabelList(params) {
    return request({
        url: moduleName + 'api/bind/product/filterAssetLabelList',
        method: 'post',
        data: params,
        showLoading: false
    })
}

// 查询签码列表集合
export function getAssetLabelList(params) {
    return request({
        url: moduleName + 'api/bind/product/getAssetLabelList',
        method: 'post',
        data: params,
        showLoading: true
    })
}

// 绑定签码列表集合
export function bindAssetLabelList(params) {
    return request({
        url: moduleName + 'api/bind/product/bindAssetLabelList',
        method: 'post',
        data: params,
        showLoading: true
    })
}

// 无签码绑定数量校验精度
export const checkMateLabelPrecision = (params) => {
    return request({
        url: `${moduleName}api/bind/product/checkPrecision?materialCode=` + params.materialCode + '&receiveAmount=' + params.receiveAmount,
        method: 'get'
    })
}
